<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登陆页</title>
    <link href="/layui-v2.6.4/css/layui.css" rel="stylesheet">
    <script src="/layui/layui.js"></script>
    <script src="/layui/jquery.min.js"></script>
    <script src="/layui/axios.min.js"></script>
    <script src="/layui/vue.min.js"></script>
</head>
<body style="background-color: rgb(242,242,242)">
<div class="layui-row">
    <div class="layui-col-md12" style="text-align: center">
        <ul class="layui-nav">
            <li class="layui-nav-item"><h1 style="font-size: 20px">律师事务所后台管理系统登陆</h1></li>
        </ul>
    </div>
</div>
<div class="layui-row" style="margin-top: 180px">
    <div class="layui-col-md4 layui-col-md-offset4">
        <div class="layui-panel">
            <div style="padding: 50px 30px;">
                <h2 style="text-align: center">用户登陆</h2>
                <br>
                <form class="layui-form">
                    <div class="layui-form-item">
                        <label class="layui-form-label">登录名</label>
                        <div class="layui-input-block">
                            <input type="text" name="userName" lay-verify="required" lay-reqtext="用户名是必填项，岂能为空？" placeholder="请输入登录名" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密码</label>
                        <div class="layui-input-block">
                            <input type="password" name="userPassword" lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div style="text-align: center">
                        <button class="layui-btn layui-btn-primary" type="button" lay-submit lay-filter="login">立即登陆</button>
                        <button class="layui-btn layui-btn-danger" type="reset" lay-submit lay-filter="login">重置表单</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use(['form','layer'],function () {
        var form = layui.form,layer = layui.layer;

        form.on('submit(login)',function (data) {
            axios.post('/end/user/login',data.field).then(res => {
                layer.msg(res.data.msg, {
                    icon: 16
                    ,shade: 0.01
                });

                setTimeout(function () {
                    location.href = res.data.data;
                },1000)
            })
            return false
        })

    })
</script>
</html>
